package me.zhengjie.modules.fund.repository;

import me.zhengjie.modules.fund.domain.UserStock;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Set;

public interface UserStockRepository extends JpaRepository<UserStock, Long>, JpaSpecificationExecutor<UserStock> {

    /**
     * 根据用户id和股票code获取
     *
     * @param userId
     * @param code
     * @return
     */
    UserStock findByUserIdAndStockCode(Long userId, String code);

    /**
     * 查询指定编码的股票列表
     *
     * @param stockCode
     * @return
     */
    List<UserStock> findByStockCode(String stockCode);

    /**
     * 根据Id删除
     *
     * @param ids /
     */
    void deleteAllByIdIn(Set<Long> ids);
}
